const express = require('express')
const app = express()

app.set('secret','i7d6o5l3m4a6s2t8e3r')//这个密钥应该放到环境变量当中

// 解决跨域问题
app.use(require('cors')())
app.use(express.json())
app.use('/',express.static(__dirname + '/web'))
app.use('/admin/',express.static(__dirname + '/admin'))
app.use('/upload',express.static(__dirname + '/upload'))

require('./plugins/db')(app)
// 引入admin接口,传入express对象
require('./routes/admin')(app)

app.listen(3000, () => {
  console.log('http://localhost:3000')
})